home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
libs
/
pdcurs21
/
private
/
_gotoxy.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-18
|
2KB
|
80 lines
#define CURSES_LIBRARY 1
#include <curses.h>
#ifdef UNIX
#include <defs.h>
#include <term.h>
#endif
#ifdef PDCDEBUG
char *rcsid__gotoxy = "$Header: C:\CURSES\private\RCS\_gotoxy.c 2.1 1993/06/18 20:23:26 MH Rel MH $";
#endif
/*man-start*********************************************************************
PDC_gotoxy() - position hardware cursor at (x, y)
PDCurses Description:
This is a private PDCurses routine.
Moves the physical cursor to the desired address on the
screen. We don't optimize here -- on a PC, it takes more time
to optimize than to do things directly.
PDCurses Return Value:
This function returns OK on success and ERR on error.
PDCurses Errors:
No errors are defined for this function.
Portability:
PDCurses int PDC_gotoxy( int row, int col );
**man-end**********************************************************************/
int PDC_gotoxy(int row, int col)
{
#ifdef PDCDEBUG
if (trace_on) PDC_debug("PDC_gotoxy() - called: row %d col %d\n",row,col);
#endif
#ifndef UNIX
if ((_cursvar.cursrow == row) && (_cursvar.curscol == col))
return( OK );
#endif
#ifdef FLEXOS
retcode = s_get(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
if (retcode < 0L)
return( ERR );
vir.vc_cursor.pos_row = row;
vir.vc_cursor.pos_col = col;
retcode = s_set(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
return( (retcode < 0L) ? ERR : OK );
#endif
#ifdef DOS
regs.h.ah = 0x02;
regs.h.bh = _cursvar.video_page;
regs.h.dh = (unsigned char) row;
regs.h.dl = (unsigned char) col;
int86(0x10, ®s, ®s);
return( OK );
#endif
#ifdef OS2
VioSetCurPos (row, col, 0);
return(OK);
#endif
#ifdef UNIX
if (cursor_address != NULL)
{
putp(tparm(cursor_address,row,col));
}
return(OK);
#endif
}